<?php
	$mkjur=$_POST["sel_jurusan"];
	//$matakuliah='mk'.substr($mkjur,0,3);
	$matakuliah='mk';
?>

<STYLE type=text/css>.blank {
	FONT-SIZE: 0px; WIDTH: 0px; HEIGHT: 0px
}
TD {
	FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
INPUT {
	FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
.present {
	FONT-WEIGHT: bold; BACKGROUND-COLOR: #dee5ec
}
.h1 {
	FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #ffffff
}
.d1 {
	COLOR: #c0c0c0
}
.link {
	FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: #ffffff; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.footer {
	FONT-WEIGHT: normal; FONT-SIZE: 10px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.footer1 {
	FONT-WEIGHT: bold; FONT-SIZE: 10px; BACKGROUND-IMAGE: url(chat/images/menu_b.gif); CURSOR: default; COLOR: #000000; BORDER-BOTTOM: 0px
}
.header {
	FONT-WEIGHT: bold; FONT-SIZE: 10px; BACKGROUND-IMAGE: url(chat/images/menu_h.gif); CURSOR: default; COLOR: #000000; BORDER-BOTTOM: 0px
}
.textcol {
	FONT-SIZE: 12px; COLOR: #2378d5; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
</STYLE>

<?php
	$sel_periode=$_POST["sel_periode"];
	$sel_sesi=$_POST["sel_sesi"];
	$kodejur=substr($mkjur,0,3);
	include("../connect.php");
	$pilih=mysql_select_db("uwika_krs",$conn);
	echo "<br><BR>";
	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Daftar mata kuliah yang ditawarkan pada ";
	echo "<br>";
	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Jurusan : " . $mkjur;
	echo "<br>";
	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Periode : " . $sel_sesi . "/" . $sel_periode;
	$txtsesi=$sel_sesi;
	$txtperiode=$sel_periode;
	$txtkodejur=$kodejur;
	echo "<br><br>";
	echo "<table width=\"100%\" border=\"0\">";
	echo "<table align=center width=\"700\" border=\"1\">";
	echo "<tr>";
	echo "<td width=\"10%\"><center>K O D E</center></td>";
	echo "<td width=\"50%\"><center>N A M A &nbsp; M A T A K U L I A H </center></td>";
	echo "<td><center> HARI </center></TD>";
	echo "<td><center> MULAI </center></TD>";
	echo "<td><center> SELESAI </center></TD>";
	echo "<td width=\"5%\"><center>SEMESTER</center></td>";
	echo "</tr>";

	$sqlstr="select penawaran.hari, penawaran.mulaipukul, penawaran.selesaipukul, penawaran.recno, penawaran.kodemk,$matakuliah.nama,penawaran.semester,penawaran.pagu FROM penawaran,$matakuliah where penawaran.sesi='$sel_sesi' and penawaran.periode='$sel_periode' and penawaran.jurusan='$kodejur' and penawaran.kodemk=$matakuliah.kodemk order by penawaran.kodemk";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	do {
		list($hari,$mulaipukul,$selesaipukul,$recno,$kodemk,$namamk,$semester,$pagu) = $row;
		if (empty($kodemk)) {
		echo "<BR>";
		break;
		} 
		echo "<tr><td width=\"10%\"><center><a href=\"pnwrnmk3.php?recno=$recno&kodemk=$kodemk&namamk=$namamk&semester=$semester&sesi=$sel_sesi&periode=$sel_periode&jurusan=$kodejur\"> $kodemk </a></center></td>";
		echo "<td width=\"50%\"> $namamk </td>";
		echo "<td> $hari </td>";
		echo "<td> $mulaipukul </td>";
		echo "<td> $selesaipukul </td>";
		echo "<td width=\"5%\"><center> $semester </center></td>";
		echo "</tr>";
	} while ($row=mysql_fetch_row($hasil));
	echo "</table></table>";
	echo "<br>";
	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *) Klik pada kode mata kuliah untuk merubah data atau klik <a href=\"pnwrnmk.php\">disini</a> untuk melihat prodi yg lain ...";
	echo "<br><br>";
	echo "<hr width=750>";
	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Tambah Penawaran Mata Kuliah";
	echo "<hr width=750>";
	echo "<form name=\"frmdaftar\" method=\"post\" action=\"addpnwrn.php\">";
	echo "<input type=hidden name=txtkodejur value=" . $txtkodejur . ">";
	echo "<input type=hidden name=txtsesi value=" . $txtsesi . ">";
	echo "<input type=hidden name=txtperiode value=" . $txtperiode . ">";
	echo "<table width=\"100%\" border=\"0\">";
	echo "<tr><td width=\"5%\"></td><td width=\"40%\">Kode Mata Kuliah</td>";
	echo "<td width=\"2%\"> : </td>";
	echo "<td>";
	echo "<select name=\"sel_kodemk\">";
	$sqlstr="SELECT kodemk FROM $matakuliah order by kodemk";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
    do {
		list($kodemkall) = $row;
		echo "<option>";
		echo $kodemkall;
		echo "</option>";
	} while ($row=mysql_fetch_row($hasil));
	echo "</td></tr>";
	echo "<tr><td width=\"5%\"></td><td width=\"20%\">Semester</td>";
	echo "<td width=\"2%\"> : </td>";
	echo "<td><input name=\"txtsemester\" type=\"text\" maxlength=\"2\" size=\"2\"></td></tr>";
	echo "<tr><td width=\"5%\"></td><td width=\"20%\">Hari</td>";
	echo "<td width=\"2%\"> : </td>";
	echo "<td><select name=\"sel_hari\">";
	echo "<option>SENIN</option>";
	echo "<option>SELASA</option>";
	echo "<option>RABU</option>";
	echo "<option>KAMIS</option>";
	echo "<option>JUMAT</option>";
	echo "<option>SABTU</option>";
	echo "<option>BEBAS</option>";
	echo "</select></td></tr>";
	echo "<tr><td width=\"5%\"></td><td width=\"20%\">Mulai Pukul</td>";
	echo "<td width=\"2%\"> : </td>";
	echo "<td><input name=\"txtmulaipukul\" type=\"text\" value=\"08:00:00\" maxlength=\"8\" size=\"8\"> WIB</td></tr>";
	echo "<tr><td width=\"5%\"></td><td width=\"20%\">Selesai Pukul</td>";
	echo "<td width=\"2%\"> : </td>";
	echo "<td><input name=\"txtselesaipukul\" type=\"text\" value=\"08:00:59\" maxlength=\"8\" size=\"8\"> WIB</td></tr>";
	echo "<tr><td width=\"5%\"></td><td width=\"20%\">Kuota Kelas</td>";
	echo "<td width=\"2%\"> : </td>";
	echo "<td><input name=\"txtpagu\" type=\"text\" maxlength=\"3\" size=\"3\" value=\"0\"></td></tr>";
	echo "<tr><td width=\"5%\"></td><td width=\"20%\">Dosen Pengajar</td>";
	echo "<td width=\"2%\"> : </td>";
	echo "<td><input name=\"txtdosen\" type=\"text\" maxlength=\"60\" size=\"50\"></td></tr>";
	echo "<tr><td width=\"5%\"></td><td width=\"20%\">Keterangan</td>";
	echo "<td width=\"2%\"> : </td>";
	echo "<td><input name=\"txtketerangan\" type=\"text\" maxlength=\"100\" size=\"100\"></td></tr>";
	echo "<tr><td>&nbsp;</td></tr>";
	echo "<tr><td width=\"5%\"></td><td></td><td></td>";
	echo "<td><input name=\"cmdSimpan\" type=\"submit\" value=\"Simpan\">&nbsp;<input type=\"button\" value=\"Batal\" onClick=\"javascript: history.go(-1)\"></td></tr>";
	echo "</table>";
	echo "</form>";
	echo "<br><br>";
	mysql_close($conn);
?>